package ruifight.member.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import ruifight.member.dao.IntegralRecordMapper;
import ruifight.member.model.IntegralRecord;
import ruifight.member.model.IntegralRecordExample;
import ruifight.member.service.IntegralRecordService;
import ruifight.member.service.base.BaseServiceImpl;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class IntegralRecordServiceImpl extends BaseServiceImpl<IntegralRecord, IntegralRecordExample, Long> implements IntegralRecordService {

    @Resource
    IntegralRecordMapper integralRecordMapper;

    public PageInfo<IntegralRecord> getIntegralRecordList(int cur_page, int page_size, Map<String, String> paramMap){
        PageHelper.startPage(cur_page, page_size);
        List<IntegralRecord> pageList = integralRecordMapper.getIntegralRecordList(paramMap);
        PageInfo<IntegralRecord> pageInfo = new PageInfo<IntegralRecord>(pageList);
        return pageInfo;
    }

    public PageInfo<IntegralRecord> getIntegralRecordAllList(int cur_page, int page_size, Map<String, String> paramMap){
        PageHelper.startPage(cur_page, page_size);
        List<IntegralRecord> pageList = integralRecordMapper.getIntegralRecordAllList(paramMap);
        PageInfo<IntegralRecord> pageInfo = new PageInfo<IntegralRecord>(pageList);
        return pageInfo;
    }

    public int getConsumptionIntegral(Map<String, String> paramMap){
        return integralRecordMapper.getConsumptionIntegral(paramMap);
    }
}
